<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath %>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>农资与农产品全程供应链物流平台-客户信息</title>
<meta name="kewywords" content="农资与农产品全程供应链物流平台"/>
<meta name="description" content="农资与农产品全程供应链物流平台"/>
<link href="css/style.css" type="text/css" rel="stylesheet"/>
<link rel="icon" href="js/dialog/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/LocalList.js"></script>
<script type="text/javascript" src="js/dialog/lhgdialog.js?skin=default"></script>	
	<script type="text/javascript">
		$(document).ready(function(){
			init("province","","city","","district","");
			$("#customerTb tr:odd").addClass("odd");	
			$("#customerTb tr:even").addClass("even");
		});
		function editCheck(){
			var selected_value = [];    
			$("input[name='ids']:checked").each(function(){    
			 	selected_value.push($(this).val());    
			});    
			if(selected_value.length == 0) {
				$.dialog.alert("你还没有选择任何内容"); 
				return false;
			} else if(selected_value.length > 1){
				$.dialog.alert("一次只能修改一条记录！"); 
				return false;
			}
			var id = selected_value;
			//$("#selectId").val(id);
			document.getElementById("editCustomerId").value=id;
			//alert($("#selectId").val());				
			$("#editCustomer").submit();
		}
		function deleteCheck(){
			var selected_value = [];    
			$("input[name='ids']:checked").each(function(){    
			 	selected_value.push($(this).val());    
			});    
			if(selected_value.length == 0) {
				$.dialog.alert("你还没有选择任何内容"); 
				return false;
			} 
			$.dialog.confirm("确定要删除吗？", 
		    	function(){			    	
					var id = selected_value;
					document.getElementById("deleteCustomerIds").value=id;
					$("#deleteCustomer").submit();
				}, function(){}
			);			
		}
		function queryCheck(){
			var values = getSelectedValue("province") + "," +
				getSelectedValue("city") + "," +
				getSelectedValue("district");
				//alert(values);
			$("#areaValues").val(values);
			$("#queryCustomer").submit();
		}
		function getSelectedValue(selectId){
			var select = document.getElementById(selectId);
			var index = select.selectedIndex;
			var value = select.value;
			if(value == ""){
				value="-";
			}
			return value;
		}
	</script>
</head>
<body>
<%@include file="top.jsp" %>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	    <td width="187" height="37" bgcolor="#e0e0e0" class="brt bbt">
		    <div class="topleft fl">系统菜单栏</div>
		</td>
	    <td bgcolor="#e7e7e7" class=" bbt">
		    <div class="topleft fl">您现在的位置：<a href="#">首页</a>&nbsp;>&nbsp;<span>客户信息</span>
		    </div>
	    </td>
	</tr>
	<tr>
		<td width="187" height="100%" valign="top" bgcolor="#FFFFFF" class="brt">
			<div class="left_bk">          
				<div class="menu2">
					<%@include file="database_left.jsp" %>
				</div>        
			</div>
		</td>
		<td align="left" valign="top" bgcolor="#FFFFFF">
			<div class="content">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td height="38" style="background:url(images/zz_tit.jpg) left top repeat-x;">
							<div class="tt_back fl">客户列表信息</div>
							<div class="fr">
								<img src="images/tit_right.jpg" alt="" width="103" height="38" />
							</div>
						</td>
					</tr>
			        <tr>
						<td class="borders btn">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td height="41" bgcolor="#fffeee" style="border-bottom:#fee7bd solid 1px;">
										<form id="queryCustomer" action="queryCustomer" method="post">	
											<s:hidden  id="areaValues" name="areaValues" />		
											<table width="1000" border="0" cellspacing="0" cellpadding="0" align="left">
												<tr>
												    <td width="80" align="right">客户姓名：</td>
												    <td width="136"><input type="text" name="customer.name" class="input_are w122" /></td>
												    <td width="80" align="right">公司名称：</td>
												    <td width="136"><input type="text" name="customer.company" class="input_are w122" /></td>
												    <td width="80" align="right">区  域：</td>
												    <td width="408" class="whitetdstyle">
													    <script type="text/javascript">
															//var defaultValue = $("#areaLabels");
															var options = {
																country: "province",		// “省”下拉列表的名称
																state: "city",				// “市”下拉列表的名称
																city: "district",				// “区”下拉列表的名称
																current: "|||",		// 当前默认值，用管道符“|”分割
																language: "zh_cn",			// 数据文件的语言
																path_to_xml: "js/data/china/",	// 数据文件的目录
																read_only: false			// 数据是否只读，若设置为true，则无需设置 country 和 state
															};
															LocalList.mf_init(options);											
														</script>	
												    </td>
												    <td width="80">
												    	<input type="image" type="button" onclick="queryCheck()" src="images/cx.jpg" />
												    </td>
												</tr>
											</table>
										</form>
									</td>
								</tr>
								<tr>
									<td align="center">
										<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
											<tr align="left">
												<td height="42" colspan="2">
											        <input type="button" id="addBt" style="cursor: pointer;" class="buttons2" value="新  增"
											        	onclick="location.href='addCustomer'" />
											        <input type="button" id="editBt" class="buttons2" style="cursor: pointer;" value="修  改"
											        	onclick="editCheck()" />
											        <input type="button" class="buttons2" id="deleteBt" value="删  除" style="cursor: pointer;" 
											        	onclick="deleteCheck()" />
											        <form id = "editCustomer" action="editCustomer" method="post">
														<input type="hidden" id="editCustomerId" name = "editCustomerId" value="0" />								
													</form>
													<form id="deleteCustomer" action="deleteCustomer" method="post">
														<input type="hidden" id="deleteCustomerIds" name="deleteCustomerIds" value=""/>
													</form>
										        </td>
											</tr>
											<tr>
												<td colspan="2">
												<div style="height:300px">
											        <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e3e3e3" >
														<tr class="captit">
												            <td width="5%" height="31" align="center" valign="middle">
												            	<input type="checkbox" class="checks" />
												            </td>
												            <td width="10%" height="31" align="center" valign="middle">姓名</td>
												            <td width="5%" height="31" align="center" valign="middle">性别</td>
												            <td width="11%" height="31" align="center" valign="middle">电话</td>
												            <td width="15%" height="31" align="center" valign="middle">公司</td>
												            <td width="8%" height="31" align="center" valign="middle">省</td>
												            <td width="11%" height="31" align="center" valign="middle">市</td>
												            <td width="11%" height="31" align="center" valign="middle">区/县</td>
												            <td width="16%" height="31" align="center" valign="middle">地址</td>
												            <td width="8%" height="31" align="center" valign="middle">登记人</td>
														</tr>
														<s:set var="pager" value="pager"/>
														<s:iterator value="#pager.items" id="customer" >
														<tr height="26" bgcolor="#efefef">
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF">
												            	<input type="checkbox" name="ids" value="<s:property value="#customer.id"/>" /></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF" class="wordblue">
												            	<s:property value="#customer.name"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF">
													            <s:set name="sex" value="#customer.sex"/>
																<s:if test="#sex == 0">男</s:if>
																<s:else>女</s:else>
												            </td>
															<td height="26" align="center" valign="middle" bgcolor="#FFFFFF">
												            	<s:property value="#customer.telephone"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF" class="wordblue">
												            	<s:property value="#customer.company"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF">
												            	<s:property value="#customer.province"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF">
												            	<s:property value="#customer.city"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF">
												            	<s:property value="#customer.district"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF" class="wordblue"><s:property value="#customer.address"/></td>
												            <td height="26" align="center" valign="middle" bgcolor="#FFFFFF" ><s:property value="#customer.registrant"/></td>
														</tr>
														</s:iterator>
													</table>
									        	</div>
									        	</td>
											</tr>
											<tr>
										        <td width="30%" height="50">
											        
												</td>
										        <td width="70%">
													<table width="700" border="0" align="right" cellpadding="0" cellspacing="0">
														<!-- 
														<tr>
												            <td width="96" height="26"><div class="prepage wordblue"><a href="#">上一页</a></div></td>
												            <td width="198"><div class="pagelist"><a href="#">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a> ...<a href="#">100</a></div></td>
												            <td width="117"><div class="nextpage wordblue"><a href="#">下一页</a></div></td>
												            <td width="171" align="right" class="wordblue">共10页 当前第2页 到第</td>
												            <td width="42" align="center"><input type="text" style=" border:#dbdbdb solid 1px; width:30px; height:18px;"/></td>
												            <td width="22" class="wordblue">页</td>
												            <td width="54" align="center"><a href="#"><img src="images/bt.jpg" alt="" width="43" height="24" /></a></td>
														</tr> -->
														<tr>
															<td width="100%" >${pager.paginationModel}</td>
														</tr>
													</table>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>
<div class="bottom">版权所有：安徽朗坤物联网</div>
</body>
</html>